package com.mcx.modules.data.localdata.create;

import com.mcx.modules.data.GameDataTableParser;
import com.mcx.modules.data.base.AbstractDBModel;

/** Monster数据管理 */
public class MonsterDBModel extends AbstractDBModel<MonsterDBModel, MonsterEntity>
{
    private static MonsterDBModel instance;

    public static MonsterDBModel getInstance() {
        if (instance == null) {
            instance = new MonsterDBModel();
        }
        return instance;
    }

    /** 文件名称 */
    @Override
    protected String FileName() {
        return "Monster.data";
    }

    /** 创建实体 */
    @Override
    protected MonsterEntity MakeEntity(GameDataTableParser parse)
    {
        MonsterEntity entity = new MonsterEntity();
        entity.Id = parse.GetFieldValueToInt("Id");
        entity.MonsterType = parse.GetFieldValueToInt("MonsterType");
        entity.Name = parse.GetFieldValueToUTF8String("Name");
        entity.PrefabName = parse.GetFieldValueToUTF8String("PrefabName");
        entity.TextureName = parse.GetFieldValueToUTF8String("TextureName");
        entity.HeadPic = parse.GetFieldValueToUTF8String("HeadPic");
        entity.MoveSpeed = parse.GetFieldValueToFloat("MoveSpeed");
        entity.ShowBloodBar = parse.GetFieldValueToInt("ShowBloodBar");
        entity.BloodBarLayerCount = parse.GetFieldValueToInt("BloodBarLayerCount");
        entity.UsedPhyAttack = parse.GetFieldValueToUTF8String("UsedPhyAttack");
        entity.UsedSkillList = parse.GetFieldValueToUTF8String("UsedSkillList");
        entity.CanArmor = parse.GetFieldValueToInt("CanArmor");
        entity.Armor_HP_Percentage = parse.GetFieldValueToInt("Armor_HP_Percentage");
        entity.Range_View = parse.GetFieldValueToInt("Range_View");
        entity.Attack_Interval = parse.GetFieldValueToFloat("Attack_Interval");
        entity.PhysicalAttackRate = parse.GetFieldValueToInt("PhysicalAttackRate");
        entity.DelaySec_Attack = parse.GetFieldValueToFloat("DelaySec_Attack");
        return entity;
    }
}
